'''
# MyMath类封装
class MyMath:
    def add(a,b):
        return a + b
    def minus(a,b):
        return a - b
    def times(a,b):
        return a * b
    def divide(a,b):
        return a / b
    def power(a,b):
        return a ** b
    def radic(self):
        return self ** (1/2)
print (MyMath.radic(4))
'''
#父类
class Person(object):
    def __init__(self,name,age):
        self.name = name
        self.age = age
    def speak(self):
        print(f"Hello, my name is {self.name}")
        print(f"I am {self.age} years old")

lily = Person("lily",12)
lily.speak()

#子类
class Caculate(Person):
    def add(self,a,b):
        self.a = a
        self.b = b
        print(f"I know {self.a}+{self.b}={self.a+self.b}")

robin = Caculate("Robin",3)
robin.speak()
robin.add(2,4)
